package com.hc.springbootzookeeper.mapper;


import com.hc.springbootzookeeper.entity.Product;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

@Component
public interface ProductMapper {
    @Select("select * from t_product where id=#{a}")
    Product getProduct(@Param("a") int id);

    @Update("update t_product set stock = stock - 1 where id=#{id}")
    int reduceStock(@Param("id") int id);

}
